<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>only-child选择器</title>
    <style>
        .post p {
            color: #000;
            padding: 10px;
        }
       /* :only-child  唯一 */
        .post p:only-child {
            color: red;
        }
    </style>
</head>

<body>
    <div class="post">
        <p>我是一个段落</p>
        <p>我是一个段落</p>
    </div>
    <div class="post">
        <p>我是一个段落</p>
    </div>
</body>

</html>